(function() {
	
	if (!window.CJ) {
		window.CJ = {};
	}
	
	var AutoHideCtl = {
		isHide: false,
		handleEvent: function () {
			this.show();
		},
		hide: function () {
			var self = this;
			this.stop();
			this.timer = setTimeout(function(){
				self.isHide = true;
				self.preView = $('#vod').attr('class');
				self.preObj = CJ.Scene.getDelegate();
				$('#vod').removeClass().addClass('hide');
				self.prototype.delegate.call(self);
			}, 10000);
		},
		show: function () {
			this.stop();
			this.isHide = false;
			$('#vod').removeClass().addClass(this.preView);
			CJ.Scene.setDelegate(this.preObj);
			AutoHideCtl.hide();
		},
		stop: function () {
			if (typeof this.timer !== 'undefined') {
				clearTimeout(this.timer);
				this.timer = 'undefined';
			}
		}
	};
	AutoHideCtl.prototype = new EventCtl();

	/*
		AutoHide
	*/
	$(document).on("keydown", function(evt){
		if ($("#wrap").hasClass('vod') && !AutoHideCtl.isHide) {
			//console.log('AutoHideCtl keydown 연장 hide ' + new Date());
			AutoHideCtl.hide();
		}
	});
	$(document).on("mousedown", "#vod .menu, #vod .box", function(){
		if (!AutoHideCtl.isHide) {
			//console.log('AutoHideCtl mousedown 연장 hide ' + new Date());
			AutoHideCtl.hide();
		}
	});


	CJ.AutoHideCtl = AutoHideCtl;

})();